<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <banner-com :jdata="jieshoulist"></banner-com>
      <hr />
      <list-com @sdata="getdata"></list-com>
    </div>
    <template id="list">
      <div>
        <h1>list组件</h1>
      </div>
    </template>
    <template id="banner">
      <div>
        <h1>banner组件</h1>
        <h1>{{jdata}}</h1>
      </div>
    </template>
    <script src="vue.js"></script>
    <script>
      var vm = new Vue({
        el: '#app',
        data() {
          return {
            jieshoulist: ''
          }
        },
        methods: {
          getdata(a) {
            this.jieshoulist = a
          }
        },
        components: {
          listCom: {
            template: '#list',
            data() {
              return {
                listdata: '你好'
              }
            },
            mounted() {
              this.$emit('sdata', this.listdata)
            }
          },
          bannerCom: {
            template: '#banner',
            props: ['jdata'],
            data() {
              return {}
            }
          }
        }
      })
    </script>
  </body>
</html>
